SELECT GER_TAB_PEROPE.SISTEMA,GER_TAB_PEROPE.CODPER;
       FROM GER_TAB_PEROPE;
       INTO ARRAY WPEROPE

CLOSE TABLES
USE GER_TAB_PEROPE IN 0
SET ORDER TO 4        
       
USE GER_TAB_TAREFAS IN 1

DO WHILE NOT EOF()
   WSISTEMA=SISTEMA
   WCOD=COD
   WNUMPRG=NUMPRG
   SELECT 0
   SEEK WSISTEMA+WCOD
   IF NOT FOUND()
      FOR X=2 TO ALEN(WPEROPE) STEP 2
          IF WSISTEMA==WPEROPE[X-1]
             APPEND BLANK
             REPLACE SISTEMA   WITH WSISTEMA
             REPLACE CODPER    WITH WPEROPE[X]
             REPLACE COD       WITH WCOD
             REPLACE NUMPRG    WITH WNUMPRG
             REPLACE FLGPEROPE WITH "B"
          ENDIF   
      ENDFOR
   ENDIF
   SELECT 1
   SKIP +1
ENDDO

MESSAGEBOX("PERFIS ATUALIZADOS")

